using System;
using System.Collections.Generic;
using Opc.Ua;

namespace HslCommunicationEx.OpcUa
{
	public class EventFieldConfiguration : IEquatable<EventFieldConfiguration>
	{
		private NodeId m_EventTypeId;

		private QualifiedNameCollection m_BrowsePath;

		private uint m_AttributeId;

		public QualifiedNameCollection BrowsePath
		{
			get
			{
				return this.m_BrowsePath;
			}
			set
			{
				this.m_BrowsePath = value;
			}
		}

		public NodeId EventTypeId
		{
			get
			{
				return this.m_EventTypeId;
			}
			set
			{
				this.m_EventTypeId = value;
			}
		}

		public uint AttributeId
		{
			get
			{
				return this.m_AttributeId;
			}
			set
			{
				this.m_AttributeId = value;
			}
		}

		public EventFieldConfiguration()
		{
			this.m_AttributeId = 13u;
			this.m_BrowsePath = new QualifiedNameCollection();
			this.m_EventTypeId = null;
		}

		public EventFieldConfiguration(NodeId eventTypeId, QualifiedName browsePath)
		{
			this.m_EventTypeId = eventTypeId;
			this.m_BrowsePath = new QualifiedNameCollection();
			this.m_AttributeId = 13u;
			this.m_BrowsePath.Add(browsePath);
		}

		public EventFieldConfiguration(NodeId eventTypeId, List<QualifiedName> browsePath)
		{
			this.m_EventTypeId = eventTypeId;
			this.m_BrowsePath = new QualifiedNameCollection(browsePath);
			this.m_AttributeId = 13u;
		}

		public EventFieldConfiguration(NodeId eventTypeId, List<QualifiedName> browsePath, uint attributeId)
		{
			this.m_EventTypeId = eventTypeId;
			this.m_BrowsePath = new QualifiedNameCollection(browsePath);
			this.m_AttributeId = attributeId;
		}

		public bool Equals(EventFieldConfiguration other)
		{
			if (this.m_EventTypeId != other.m_EventTypeId)
			{
				return false;
			}
			if (this.m_BrowsePath.Count != other.m_BrowsePath.Count)
			{
				return false;
			}
			for (int i = 0; i < this.m_BrowsePath.Count; i++)
			{
				if (!this.m_BrowsePath[i].Equals(other.m_BrowsePath[i]))
				{
					return false;
				}
			}
			return true;
		}

		public SimpleAttributeOperand ToSimpleAttributeOperand()
		{
			SimpleAttributeOperand simpleAttributeOperand = new SimpleAttributeOperand(this.m_EventTypeId, this.m_BrowsePath);
			simpleAttributeOperand.AttributeId = this.m_AttributeId;
			return simpleAttributeOperand;
		}
	}
}
